package com.pshcp.patient.tool;

import com.external.ws.szsk.res.PatientWaitInfo;
import com.external.ws.szsk.res.QueueWaitInfo;
import com.pshcp.patient.domain.searchqueue.vo.PatientWaitListVO;
import com.pshcp.patient.domain.searchqueue.vo.QueueListVO;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class SearchQueueTools {

    /**
     * 科室等待
     * @param queueWaitInfos
     * @return
     */
    public static List<QueueListVO> buildQueueListVO(List<QueueWaitInfo> queueWaitInfos){
        List<QueueListVO> voList = new ArrayList<>();
        if(CollectionUtils.isEmpty(queueWaitInfos)){
            return voList;
        }
        queueWaitInfos.forEach(item -> {
            QueueListVO vo = new QueueListVO();
            vo.setPatientId(item.getPatient_id());
            vo.setPatientName(item.getPatient_name());
            vo.setRegisterId(item.getRegister_id());
            vo.setQueueTypeSourceId(item.getQueue_type_source_id());
            vo.setQueueTypeName(item.getQueue_type_name());
            vo.setPatientStateDm(item.getPatient_state_dm());
            vo.setPatientStateMc(item.getPatient_state_mc());
            vo.setDoctorId(item.getDoctor_id());
            vo.setDoctorName(item.getDoctor_name());
            vo.setCheckinTime(item.getCheckin_time());
            vo.setReserveTime(item.getReserve_time());
            vo.setReserveEndTime(item.getReserve_end_time());
            vo.setWaitCount(item.getWait_count());
            voList.add(vo);
        });
        return voList;
    }

    /**
     * 患者等待
     * @param patientWaitInfos
     * @return
     */
    public static List<PatientWaitListVO> buildPatientListVO(List<PatientWaitInfo> patientWaitInfos){

        List<PatientWaitListVO> voList = new ArrayList<>();
        if(CollectionUtils.isEmpty(patientWaitInfos)){
            return voList;
        }
        patientWaitInfos.forEach(item -> {
            PatientWaitListVO vo = new PatientWaitListVO();
            vo.setPatientId(item.getPatient_id());
            vo.setPatientName(item.getPatient_name());
            vo.setRegisterId(item.getRegister_id());
            vo.setQueueTypeSourceId(item.getQueue_type_source_id());
            vo.setQueueTypeName(item.getQueue_type_name());
            vo.setPatientStateDm(item.getPatient_state_dm());
            vo.setPatientStateMc(item.getPatient_state_mc());
            vo.setDoctorId(item.getDoctor_id());
            vo.setDoctorName(item.getDoctor_name());
            vo.setCheckinTime(item.getCheckin_time());
            vo.setReserveTime(item.getReserve_time());
            vo.setReserveEndTime(item.getReserve_end_time());
            vo.setWaitCount(item.getWait_count());
            vo.setCallMax(item.getCall_max());
            voList.add(vo);
        });
        return voList;
    }

}
